#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.57)
AC_INIT([tgr],[1.0],[moorthy@cs.rpi.edu])
AC_CONFIG_SRCDIR([src/dirpartition.c])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE

AC_ARG_WITH(graphpack,
	[--with-graphpack=<path> prefix of graphpack header directory],
	[GRAPHPACK=$with_graphpack],
	[GRAPHPACK=`pwd`/graphpack-1.0/src])
	AC_SUBST(GRAPHPACK)
                                                                                                                                              
AC_ARG_WITH(weblog,
	[--with-weblog=<path> prefix of weblog header directory],
	[WEBLOG=$with_weblog],
	[WEBLOG=`pwd`/webloglib-1.0/src])
	AC_SUBST(WEBLOG)

AC_ARG_WITH(htmlrep,
	[--with-htmlrep=<path> prefix of htmlrep header directory],
	[HTMLREP=$with_htmlrep],
	[HTMLREP=`pwd`/htmlreplib-1.0/src])
	AC_SUBST(HTMLREP)

AC_ARG_WITH(w3c-libwww,
	[  --with-w3c-libwww=<path> prefix of w3c's www library directory],
	[W3C_WWW=$with_w3c-libwww],
	[
	if test -e "/usr/local/include/w3c-libwww"; then
		W3C_WWW="/usr/local/include/w3c-libwww";
	else
		AC_MSG_ERROR([call this script --with-w3c-libwww])
	fi])
	AC_SUBST(W3C_WWW)

# Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB

AC_CHECK_LIB([graphpack], [layer_maxm])
AC_CHECK_LIB([htmlrep], [main])
AC_CHECK_LIB([m], [main])
AC_CHECK_LIB([xmlparse], [main])
AC_CHECK_LIB([xmltok], [main])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([sys/time.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_C_CONST
AC_STRUCT_TM
AC_TYPE_SIGNAL

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_MKTIME
AC_FUNC_STRFTIME

AC_CHECK_FUNCS([strcasecmp])
AC_CHECK_FUNCS([sqrt])
AC_CHECK_FUNCS([pow])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([alarm])
AC_CHECK_FUNCS([getcwd])
AC_CHECK_FUNCS([gethostbyaddr])
AC_CHECK_FUNCS([gethostbyname])
AC_CHECK_FUNCS([inet_ntoa])
AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strncasecmp])
AC_CHECK_FUNCS([strrchr])
AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([strtol])

AC_CONFIG_FILES([Makefile
	graphpack-1.0/Makefile
	graphpack-1.0/src/Makefile
	webloglib-1.0/Makefile
	webloglib-1.0/src/Makefile
	htmlreplib-1.0/Makefile
	htmlreplib-1.0/src/Makefile
	src/Makefile])
AC_OUTPUT
